﻿using System;
using System.Collections.Generic;
using System.Text;

namespace HAVNet.Intros.AST
{
    public class ASTMemberDeclDtor : ASTMemberDeclClass
    {
        public string   name    { get; set; }
        public ASTBlock block   { get; set; }

        public override string ToString()
        {
            string sAttrs = ((null == _attrGroups) ? "" : _attrGroups.ToString() + Environment.NewLine);
            
            //  destructorsMod =
            //      externMod |
            //      unsafeMod ,

            string mods = "";
            if (Mods.has(modifiers, Mods.externMod)) mods += "extern ";
            if (Mods.has(modifiers, Mods.unsafeMod)) mods += "unsafe ";
            
            string sBlock = (null == block ? ";" : block.ToString()); 

            return
                sAttrs  + Environment.NewLine +
                "~ " + name + " ()" + Environment.NewLine +
                sBlock  ;
        }
    }
}
